//获取应用实例
const app = getApp();

Page({
  data: {
    val: '',
    select: false,
    tihuoWay: '14',
    id: 14,
    chicun: '21*29.7cm',
    // 组件所需的参数
    nvabarData: {
      showCapsule: 1, //是否显示左上角图标   1表示显示    0表示不显示
      title: '文字速印', //导航栏 中间的标题
    },
    // 此页面 页面内容距最顶部的距离
    height: app.globalData.height * 2 + 20,
  },
  onLoad() {
  },
  bindShowMsg() {
    this.setData({
      select: !this.data.select
    })
  },
  mySelect(e) {
    var name = e.currentTarget.dataset.name
    this.setData({
      tihuoWay: name,
      select: false,
    })

  },
  passtxt(e) {
    this.setData({
      content: e.detail.value
    })
  },
  // 提交表单
  submit: function () {
    let that = this;
    let content = that.data.content;
    if (content == '') {
      wx.showToast({
        title: '请输入内容',
        icon: 'none',
        duration: 2000
      })
    } else {
      let size = that.data.tihuoWay;
      let title = that.data.nvabarData.title;
      let url = app.globalData.URL + 'facility/printOrder/word'
      let data = {
        content: content,
        size: size
      };
      console.log('3')
      wx.request({
        url: url,
        data: data,
        header: {
          'Accept': 'application/json',
          'Authorization': app.globalData.token
        },
        success(res) {
          console.log(res)
          let docs = [res.data.msg]
          console.log(docs[0])
          wx.navigateTo({
            url: '/modelA/pages/documents_printing/picplace_order/picplace_order?content=' + docs + '&title=' + title + '&id=' + that.data.id + '&chicun=' + that.data.chicun,
          })
        },
        fail(res) {
          console.log(res)
        }

      })


    }

  }


})
